package com.cryann.mqttserver.repository;

import com.cryann.mqttserver.modle.Accessor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * @author cRyann
 * @date 2018/12/6 0006 17:22
 * @description:
 */
public interface AccessorRepository extends JpaRepository<Accessor, String>, CrudRepository<Accessor, String> {
    Accessor findByChannelId(String channelId);
    Accessor findAccessorByAccessorName(String accessorName);

    @Query(value = "select * from accessor a where a.topic_name=?1", nativeQuery = true)
    List<Accessor> findByTopicName(String topicName);
}
